﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Simple.Repository.Models.Article;
using Simple.Repository.Models.Market;
using Simple.Services.System.Article.Model;

namespace Simple.Services.System.Market.Models
{
    public class CommodityModel : ModelBase
    {
        /// <summary>
        /// 主键Id
        /// </summary>
        public Guid? Id { get; set; } = null;
        /// <summary>
        /// 商品名称/标题
        /// </summary>
        public string Title { get; set; } = "";

        /// <summary>
        /// 是否上架显示
        /// </summary>
        public bool IsShow { get; set; } = false;

        /// <summary>
        /// 库存
        /// </summary>
        public int StockCount { get; set; }

        /// <summary>
        /// 现已卖出多少
        /// </summary>
        public int SoldCount { get; set; }

        /// <summary>
        /// 价值积分
        /// </summary>
        public int Integral { get; set; }

        /// <summary>
        /// 内容或描述
        /// </summary>
        public string Content { get; set; } = "";

        /// <summary>
        /// 分类Id
        /// </summary>
        public Guid? CategoryId { get; set; }

        /// <summary>
        /// 分类信息
        /// </summary>
        public CommodityCategory? CategoryInfo { get; set; }

        /// <summary>
        /// 图片集合
        /// </summary>
        public List<CommodityImage>? Images { get; set; }

        public override void ConfigureMapper(Profile profile)
        {
            profile.CreateMap<Commodity, CommodityModel>();

            profile.CreateMap<CommodityModel, Commodity>();

            profile.CreateMap<Commodity, CommodityCreateOrUpdateModel>();

            profile.CreateMap<CommodityCreateOrUpdateModel, Commodity>();
        }
    }
}
